<template>
  <div>
    <section>
      用户名：<input type="text" v-model="username">
    </section>
    <section>
      密 码：<input type="password" v-model="pwd">
    </section>
    <section>
      <button @click="userLogin">登 录</button>
    </section>
  </div>
</template>

<script setup>
import {ref} from 'vue'
import {useRouter} from 'vue-router'

let username = ref('')
let pwd = ref('')
let count = ref(0)

const router = useRouter()

const userLogin = () => {
  if (!username.value || !pwd.value) {
    alert('用户名或密码不能为空！')
    return
  }
  localStorage.setItem("ACCESS_TOKEN", username.value + pwd.value)
  router.replace('/')
  console.log('登录成功！')
}

</script>

<style scoped>

</style>